package com.woniuxy.orderservice.rabbit.queue;



import com.woniuxy.orderdao.model.OrderLog;
import com.woniuxy.orderservice.service.OrderLogService;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * 订单日志的消息队列
 */
@Component
public class OrderInfoLogQueue {
    @Autowired
    private OrderLogService orderLogService;

    @RabbitHandler
    @RabbitListener(queuesToDeclare = {@Queue(value ="order-log-queue")})
    public void orderInfoLogQueue(OrderLog orderLog) {
        orderLogService.save(orderLog);
    }
}
